package leetcode.L1000;

import java.util.Arrays;
import java.util.Comparator;

public class Ex1030 {

    public static void main(String[] args) {
        int R = 3,C = 4;
        int r0=0,c0=0;


        int[][] Ma = new int [R*C][2];
        for (int i = 0; i < R; i++) {
            for (int j = 0; j < C ; j++) {
                Ma[i*C+j][0] = i;
                Ma[i*C+j][1] = j;
            }
        }
        Arrays.sort(Ma, new Comparator<int[]>() {
            @Override
            public int compare(int[] a, int[] b) {
                return Math.abs(a[0]-r0)+Math.abs(a[1]-c0)-Math.abs(b[0]-r0)-Math.abs(b[1]-c0);
            }
        });

    }

}
